home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d18 / turbotut.arc / ARRAYS2.PAS < prev    next >
Pascal/Delphi Source File  |  1989-06-30  |  1KB  |  44 lines

  1. PROGRAM multiple_arrays;
  2.  
  3. VAR index,count     : INTEGER;
  4.     checkerboard    : ARRAY[1..8] OF ARRAY[1..8] OF INTEGER;
  5.     value           : ARRAY[1..8,1..8] OF INTEGER;
  6.  
  7. BEGIN (* Main program *)
  8.   FOR index := 1 TO 8 DO
  9.   BEGIN  (* index loop *)
  10.     FOR count := 1 TO 8 DO
  11.     BEGIN
  12.       checkerboard[index,count] := index + 3*count;
  13.       value[index,count] := index + 2*checkerboard[index,count];
  14.     END;
  15.   END;  (* of index loop *)
  16.  
  17.   WRITELN(' Output of checkerboard');
  18.   WRITELN;
  19.   FOR index := 1 TO 8 DO
  20.   BEGIN
  21.     FOR count := 1 TO 8 DO
  22.       WRITE(checkerboard[index,count]:7);
  23.     WRITELN;
  24.   END;
  25.  
  26.   value[3,5] := -1;  (* change some of the value matrix *)
  27.   value[3,6] := 3;
  28.   value[value[3,6],7] := 2;  (* This is the same as writing
  29.                                 value[3,7] := 2;            *)
  30.   FOR count := 1 to 3 DO WRITELN; (* Three blank lines *)
  31.   WRITELN('Output of value');
  32.   WRITELN;
  33.   FOR count := 1 TO 8 DO
  34.   BEGIN
  35.     FOR index := 1 TO 8 DO
  36.       WRITE(value[count,index]:7);
  37.     WRITELN;
  38.   END;
  39. END. (* of main program *)
  40.  
  41.  
  42.  
  43.  
  44.